package org.example.demo;

import org.example.dao.UsersDao;
import org.example.model.Users;

import java.util.Scanner;

public class demo8_InsertUsers {
    public static void main(String[] args) {
        System.out.println("请输入要添加的姓名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.next();
        //封装user对象
        Users users = new Users();
        users.setName(name);
        //调用dao
        UsersDao usersDao = new UsersDao();
        int row = usersDao.insert(users);
        if (row == 1){
            System.out.println("插入成功");
        }else {
            System.out.println("插入失败");
        }
    }
}
